package cn.cvs.mapper;

import cn.cvs.pojo.SysUser;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * SysUserMapper实现类（通过SqlSessionTemplate操作数据库）
 */

public class SysUserMapperImpl implements SysUserMapper{
    //mybatis-spring包中提供的实现了SqlSession接口的类，用来操作数据库
    private SqlSessionTemplate sqlSession;

    //提供setXXX()方法给Spring使用
    public void setSqlSession(SqlSessionTemplate sqlSession){
        this.sqlSession = sqlSession;
    }

    /**
     * 查询用户列表
     * @param sysUser
     * @return
     */
    @Override
    public List<SysUser> selectSysUserList(SysUser sysUser) {
        return sqlSession.getMapper(SysUserMapper.class).selectSysUserList(sysUser);
    }

    /**
     * 查询用户列表
     * @param sysUser
     * @return
     */
    public int add(SysUser sysUser){
        return sqlSession.getMapper(SysUserMapper.class).add(sysUser);
    }
}
